<?php /* @var $receipt Receipt */ ?>
<?php use_helper('Number') ?>
<div class="category_title">
    <?php echo __('shopping history') ?>
</div>

<?php if ( !empty($arReceipts) ): ?>
    <div class="cart">
        <table width="100%" class="cart_list" cellpadding="2" cellspacing="1">
            <tr>
                <th>ID</th>
                <th><?php echo __('created at') ?></th>
                <th><?php echo __('total price') ?></th>
                <th><?php echo __('items qnt') ?></th>
                <th><?php echo __('status') ?></th>
                <th><?php echo __('actions') ?></th>
            </tr>
    <?php $i = 1; foreach($arReceipts as $receipt): $odd = fmod(++$i, 2) ?>
            <tr class="sf_admin_row_<?php echo $odd ?>">
                <td><?php echo $receipt->getId(); ?></td>
                <td><?php echo $receipt->getCreatedAt(); ?></td>
                <td><?php echo format_currency($receipt->getPriceByCurrencyCode($sf_user->getAttribute('currency', 'EUR')), $sf_user->getAttribute('currency', 'EUR')) ?></td>
                <td><?php echo $receipt->getItemsQnt();?></td>
                <td>
                    <?php echo image_tag(
                                    'status_' . $receipt->getStatusId() . '.png'
                                    , array(
                                        'alt' => __(MyConstants::getStatusName($receipt->getStatusId()))
                                        , 'title' => __(MyConstants::getStatusName($receipt->getStatusId()))
                                        , 'border' => '0'
                                    )
                                );?>
                </td>
                <td>
                    <?php echo link_to(
                                image_tag(
                                    'view.png'
                                    , array(
                                        'border' => '0'
                                        , 'alt' => __('preview')
                                        , 'title' => __('preview')
                                        , 'style' => 'margin-bottom: -3px;'
                                    )
                                )
                            , 'cart/preview?id=' . $receipt->getId()
                        )?>
                </td>
            </tr>
    <?php endforeach; ?>
        </table>
    </div>

<?php else: ?>
    <?php echo __('You have no receipts') ?>
<?php endif; ?>